package com.space.controller.no;

import com.space.config.ConfigurationJdbc;
import com.space.entity.UiConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

//@RestController
public class DatabaseController {

   /* @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ConfigurationJdbc configurationJdbc;

    @GetMapping("/testConnection")
    public String testDatabaseConnection() {
//        List<String> result = jdbcTemplate.queryForList("SELECT 'Connected to DM database successfully!' FROM dual", String.class);
        System.out.println(configurationJdbc.getById("2"));
        System.out.println(configurationJdbc.delete("4"));;
        System.out.println(configurationJdbc.insert("springboot test jf","4"));;
        System.out.println(configurationJdbc.getById("4").isEmpty()?"":configurationJdbc.getById("4").get(0).data);


        System.out.println(configurationJdbc.update("3","updte"));;
        System.out.println(configurationJdbc.getById("4").isEmpty()?"":configurationJdbc.getById("4").get(0).data);

        System.out.println(configurationJdbc.delete("4"));;
        System.out.println(configurationJdbc.getById("4").isEmpty()?"":configurationJdbc.getById("4").get(0).data);

        for(UiConfiguration t:configurationJdbc.get()) System.out.println(t.data);
//        return result.isEmpty() ? "Connection failed." : result.get(0);
        return "";

    }*/

}
